package com.itheima.service.impl;

import com.itheima.dao.UserDao;
import com.itheima.domain.Question;
import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
   @Autowired
    private UserDao userDao;


    public Boolean save(User user) {
        return userDao.save(user)>0;
    }


    public Boolean update(User user) {
        return userDao.update(user)>0;
    }


    public Boolean delete(Integer uid) {
        return userDao.delete(uid)>0;
    }

    public User getById(Integer uid) {
        User user = userDao.getById(uid);
        return user;
    }


    public User getByloginname(String loginname) {
        User user = userDao.getByloginname(loginname);
        return user;
    }


    public List<User> getAll() {
        List<User> users = userDao.getAll();
        return users;
    }
    public User getByloginname1(String loginname,Integer identity) {
        User user = userDao.getByloginname1(loginname,identity);
        return user;
    }

    @Override
    public List<User> selectAlluser(String loginname) {
        List<User> users = userDao.selectAlluser(loginname);
        return users;
    }

    @Override
    public Boolean limit(int uid, int temp) {
        int limit = userDao.limit(uid, temp);
        return limit > 0;
    }

    @Override
    public int getIdentity(int uid) {
        return userDao.getIdentity(uid);
    }

    @Override
    public Boolean Homeupdate(User user) {
        return userDao.homeUpdate(user)>0;
    }


}
